/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vendingmachine;

/**
 *
 * Nama File    : Product.Java
 * Deskripsi    : deskripsi dan implementasi kelas Product yang merupakan benda yang akan dibeli
 * Nama Pembuat : Muhammad Ghufron Mahfudhi (23512066) dan Jonathan Ery Pradana (23512038)
 * Hari/Tanggal : Senin / 26 November 2012
 */
public class Product {
    //atribut
    private int id;         //nomor jenis produk
    private String name;    //nama jenis produk
    private int price;      //harga produk dalam cents dollar

    //method
    //ctor
    public Product(){
        this.id = -99;
        this.name = "EMPTY";
        this.price = 0;
    }
    
    //ctor berparameter id
    public Product(int id){
        this.id = id;
        this.name = "EMPTY";
        this.price = 0;
    }
    
    //ctor berparameter id, nama, dan harga
    public Product(int id, String name, int price) {
        this.id = id;
        this.name = name;
        this.price = price;
    }
    
    public Product(Product P){
        this.id = P.id;
        this.name = P.name;
        this.price = P.price;
    }
    //getter
    public int getId() {
        return id;
    }
    
    public String getName() {
        return name;
    }

    public int getPrice() {
        return price;
    }
    
    //setter
    public void setId(int id) {
        this.id = id;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setPrice(int price) {
        this.price = price;
    }
    
    public void showProduct(){
        System.out.println("" + (id + 1) + ". " +  name + " : " + price + " cents");
    }
}
